<?

if(isset($_POST['email'])) {
	$salutation = isset($_POST['salutation']) ? $_POST['salutation'] : "";
	$firstname = isset($_POST['firstname']) ? $_POST['firstname'] : "";
	$lastname = $_POST['lastname'];
	$rsocial = isset($_POST['rsocial']) ? $_POST['rsocial'] : "";
	$phone = $_POST['phone'];
	$email = $_POST['email'];
	$captcha = $_POST['captcha'];
	$msg = isset($_POST['message']) && $_POST['message'] != "Votre message" ? $_POST['message'] : ""; 
    	$sessioncaptch = $_SESSION['captcha_id'];
	if($captcha != $sessioncaptch) {
		echo "echec captch";
		header("Location:form_contact.php");
		exit();
	}
	
	$MessageBody="<html>
	<head></head><body>
	<H1>Demande de contact</H1>
	<div>".$salutation."&nbsp;".$lastname."&nbsp;".$firstname."</div>
	<div>".$email."</div>
	<div>".$phone."</div>
	<div>".$rsocial."</div>
	<div>Message :</div>
	<div>".$msg."</div>
	</body>
	</html>";

	$header = 'MIME-Version: 1.0'."\r\n";
	$header .= 'Content-type: text/html;charset=iso-8859-1'."\r\n";
	$header .= "Date: ".date("D, j M Y H:i:s -0600")."\r\n";
	$header .= 'From: infos@lemeilleurestavenir.fr'."\r\n";
	$header .= "Cci: kchermi@gmail.com, tony.carpentier@gmail.com\r\n";
	$header .= 'Reply-To: '.$email."\r\n";
	$header .= 'X-Mailer: PHP/'.phpversion()."\r\n";

	$subject="Demande de contact - Le Meilleur est a venir";
	try {
		$to = "infos@lemeilleurestavenir.fr";
		$r=mail($to,$subject,$MessageBody,$header);
		//$to = "chermi.kamel@gmail.com, kchermi@gmail.com,kchermi@smartadserver.com,tony.carpentier@gmail.com";
		//$r=mail($to,$subject,$MessageBody,$header);
		//$to="tony.carpentier@gmail.com";
		//mail($to,$subject,$MessageBody,$header);
	}
	catch(exception $e) {
		
	}
}

?>
	<link rel="stylesheet" type="text/css" media="screen,print" href="/test/styles/main.css" />

	<div style="height: 90px;">&nbsp;</div>
	<div style="font-size:20px;font-weight:bold;font-family: Arial;margin-bottom: 15px;">Pour plus de renseignements ou nous rencontrer, contactez nous.</div>
	<div style="font-size:25px;font-weight:bold;font-family: Arial;margin-bottom: 15px;text-align: center;">Merci !</div>
	<div style="font-size:10px;font-family: Arial;margin-bottom: 15px;">Nous vous contacterons tr&#232;s prochainement.</div>
